var fullscreen = (function(){
	
	var downHeight = 1080;
	var upHeight = 1080;
	var Fkey = function () {
		var currentLocation = window.location.href;
		// 窗口端、弹窗页面，不全屏
		if (currentLocation.indexOf("window") > 0
				|| currentLocation.indexOf("clientDown-selfHelpExitChoose") > 0
				|| currentLocation.indexOf("clientDown-notRequirePhotos") > 0
				|| currentLocation.indexOf("form-") > 0
				|| currentLocation.indexOf("space-delete") > 0
				|| currentLocation.indexOf("appraise-confirm") > 0
				|| currentLocation.indexOf("showPic") > 0
				|| currentLocation.indexOf("complain-confirm") > 0
				 ) {
			return false;
		}
		var isClientDown = true;
		if (currentLocation.indexOf("up") > 0) {
			isClientDown = false;
		}
			// 是下屏并且不是全屏
			if(isClientDown && window.innerHeight-4 != downHeight){
				window.setTimeout("fullscreen.SendKeys()", 1000);
			}else if(!isClientDown && window.innerHeight-4 != upHeight){
				window.setTimeout("fullscreen.SendKeys()", 2000);
			}
	};
	
	var SendKeys = function () {
		$("body").focus();
		var WsShell = new ActiveXObject('WScript.Shell');
	    WsShell.SendKeys('{F11}'); 
	};
	
	return {
		Fkey : Fkey,
		SendKeys : SendKeys,
	};
	
})(window.fullscreen || {});

$(document).ready(function() {
	// 先执行一次，然后每隔5秒检测一次
	fullscreen.Fkey();
	/*window.setInterval("fullscreen.Fkey()", 5000);*/
});
